using UnityEngine;
namespace Miya.EmisssionLauncher
{
    public class Emission_Sector : Emission
    {


        //[Header("---------------绘制长度，测试用，运行时无效果---------------")]
        //public float SectorLength = 3f;
        public override EmissionData[] GetEmissions(bool _uselooper = true)
        {


            int thiscount = 0;

            if (_uselooper && (_CountLooper != null && _CountLooper.Count > 0))
                thiscount = _CountLooper.Next();
            else
                thiscount = Count;

            thiscount += _CountAddi;

            EmissionData[] _datas = new EmissionData[thiscount];

            if (thiscount <= 0) return _datas;

            int OO = 0;
            if (_uselooper && (_OffsetLooper != null && _OffsetLooper.Count > 0))
                OO = _OffsetLooper.Next();
            else
                OO = Offset;


            float thiswidth = Width + _WidthAddi;

            Vector3 op = Vector3.right * OO;

            var steps = SpliteWidth(thiswidth, thiscount);

            for (int i = 0; i < steps.Length; i++)
            {
                _datas[i] = new EmissionData()
                {
                    Owner = transform,
                    Position = Vector3.zero,
                    Direction = Quaternion.AngleAxis(OO + steps[i], Vector3.up) * Vector3.forward,
                    Duration = this.Duration,
                };
            }
            return _datas;
        }


    }
}

